//package com.android.cl.coludtf.activity.webview;
//
//import android.app.AlertDialog;
//import android.content.Intent;
//import android.os.Bundle;
//import android.view.View;
//import android.widget.ImageView;
//import android.widget.TextView;
//
//import com.android.cl.coludtf.R;
//import com.android.cl.coludtf.activity.base.BaseActivity;
//import com.android.cl.coludtf.model.BaseBO;
//import com.android.cl.coludtf.model.NinePalaces;
//import com.android.cl.coludtf.utils.dialog.DialogHelper;
//import com.android.cl.coludtf.utils.dialog.inf.OnDialogCancelListener;
//import com.android.cl.coludtf.utils.log.MyLog;
//import com.android.cl.coludtf.utils.sharedPreferences.DatabaseHelper;
//import com.github.lzyzsd.jsbridge.BridgeHandler;
//import com.github.lzyzsd.jsbridge.BridgeWebView;
//import com.github.lzyzsd.jsbridge.CallBackFunction;
//
//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.OnClick;
//
//public class Htmlview2 extends BaseActivity implements OnDialogCancelListener {
//    String TAG = "jsbridge";
//    BaseBO bo;
//    @BindView(R.id.Img_close)
//    ImageView ImgClose;
//    @BindView(R.id.Img_Back)
//    ImageView ImgBack;
//    @BindView(R.id.Wv_html)
//    BridgeWebView WvHtml;
//    private DialogHelper mDialogHelper;
//
//    @BindView(R.id.Txt_Title)
//    TextView TxtTitle;
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_htmlview);
//        ButterKnife.bind(this);
//        initView();
//        initData();
//    }
//
//    private void initView() {
//        bo = DatabaseHelper.getBaseBO();
////        WebViewTools webViewTools = new WebViewTools(webView);
//        if (mDialogHelper == null) {
//            mDialogHelper = new DialogHelper(Htmlview2.this, this);
//        }
//
////        // 在当前的浏览器中响应
////        WebSettings webSettings = WvHtml.getSettings();
////        webSettings.setJavaScriptEnabled(true);
//////      mWebView.getSettings().setDefaultFontSize(14);
////        webSettings.setAppCacheEnabled(false);
////        // // 设置可以支持缩放
////        webSettings.setSupportZoom(true);
////        // //扩大比例的缩放
////        webSettings.setUseWideViewPort(true);
////        // //自适应屏幕
////        webSettings.setLoadWithOverviewMode(true);
////
////        WvHtml.setDefaultHandler(new DefaultHandler());
////        WvHtml.setWebChromeClient(new WebChromeClient());
//
////      注册监听方法当js中调用callHandler方法时会调用此方法（handlerName必须和js中相同）
////        WvHtml.registerHandler("getToken", (data, function) -> {
////            Map<String, String> map = new HashMap<>();
////            map.put("token", bo.token);
////            //Android返回给JS的消息
////            function.onCallBack(gson.toJson(map));
////        });
//
////        WvHtml.registerHandler("getToken", new BridgeHandler() {
////            @Override
////            public void handler(String data, CallBackFunction function) {
////                MyLog.i(TAG, "handler = submitFromWeb, data from web = " + data);
////                function.onCallBack("submitFromWeb exe, response data from Java");
////            }
////        });
//    }
//
//    private void initData() {
//        Intent intent = getIntent();
//        NinePalaces ninePalaces = (NinePalaces) intent.getSerializableExtra("data");
//        if (ninePalaces != null) {
//            TxtTitle.setText(ninePalaces.getText());
//            showUrl(ninePalaces.getUrl().trim());
//        }
//    }
//
//    private void showUrl(String url) {
//        url = "file:///android_asset/test.html";
//        //访问网页
//        WvHtml.loadUrl(url);
//
//        WvHtml.registerHandler("getToken", new BridgeHandler() {
//            @Override
//            public void handler(String data, CallBackFunction function) {
//                MyLog.i(TAG, "handler = submitFromWeb, data from web = " + data);
//                function.onCallBack("submitFromWeb exe, response data from Java");
//            }
//        });
//
////
////        //系统默认会通过手机浏览器打开网页，为了能够直接通过WebView显示网页，则必须设置
////        WvHtml.setWebViewClient(new WebViewClient() {
////            @Override
////            public boolean shouldOverrideUrlLoading(WebView view, String url) {
////                //使用WebView加载显示url
////                view.loadUrl(url);
////                //返回true
////                return true;
////            }
////
////            @Override
////            public void onPageStarted(WebView view, String url, Bitmap favicon) {
////                super.onPageStarted(view, url, favicon);
////                //打开时显示加载框
////                mDialogHelper.showLoadingDialog("正在加载网页...");
////            }
////
////            @Override
////            public void onPageFinished(WebView view, String url) {
////                super.onPageFinished(view, url);
////                mDialogHelper.dismissDialog();
////            }
////
////        });
//    }
//
//    @Override
//    public void onDialogCancelListener(AlertDialog dialog) {
//
//    }
//
//    @Override
//    public void onPointerCaptureChanged(boolean hasCapture) {
//
//    }
//
//    @OnClick({R.id.Img_close, R.id.Img_Back})
//    public void onViewClicked(View view) {
//        switch (view.getId()) {
//            case R.id.Img_close:
//                finish();
//                break;
//            case R.id.Img_Back:
//                if (WvHtml.canGoBack()) {
//                    WvHtml.goBack();//返回上个页面
//                    return;
//                }
//                break;
//        }
//    }
//}
